const server = require('../../utils/server');
const app = getApp();
Page({
	data: {
    userInfo: {},
    oauth: 0,
    listMenu:[{
      oauth: 1,
      chilren:[{
        name: '我的地址',
        url: './address/index',
        desc: ''
      }]
    },{
      oauth: 0,
      chilren:[{
        name: '我的菜谱',
        url: '/page/upload/list/index',
        desc: ''
      }, {
        name: '新建菜谱',
        url: '/page/upload/editor/index',
        desc: ''
      }, {
        name: '菜谱分类',
        url: '/page/upload/sorts/index',
        desc: ''
      }, {
        name: '菜谱口味',
        url: '/page/upload/flavor/index',
        desc: ''
      }]
    },{
      oauth: 1,
      chilren:[{
        name: '在线沟通',
        url: '',
        desc:''
      }]
    }]
  },
	onShow: function () {
    this.setData({
      oauth: wx.getStorageSync('oauth'),
      userInfo: app.globalData.userInfo || {}
    })
	},
	onLoad: function () {
	},
  getUserInfo: function(e){
    var that =  this;
    app.getUserInfo(function(data){
      that.setData({
        oauth: data.oauth,
        userInfo: e.detail.userInfo
      })
    });
  },
  goPage:function(e){
    if (e.currentTarget.dataset.url){
      wx.navigateTo({
        url: e.currentTarget.dataset.url,
      })
    }
  }
});

